package com.bingo.mpa.pojo;

import java.util.Calendar;
import java.util.Locale;
import java.util.Map;

import org.apache.commons.beanutils.BeanUtils;
import org.express.portal.persist.POJO;

public class Log extends POJO
{
	private static final long serialVersionUID = 1L;
	private long lid;
	private String client_ip;
	private byte type;
	private byte severity;
	private java.sql.Timestamp ltime;
	private String ltext;
	
	public Log()
	{
		super._this_table_name = "P_LOG";
		this.ltime = new java.sql.Timestamp(Calendar.getInstance(Locale.CHINA).getTimeInMillis());
	}
	public Log(String client_ip,byte type,byte servrity,String ltext)
	{
		super._this_table_name = "P_LOG";
		this.ltime = new java.sql.Timestamp(Calendar.getInstance(Locale.CHINA).getTimeInMillis());
		this.client_ip = client_ip;
		this.type = type;
		this.severity = servrity;
		this.ltext = ltext;
	}
	
	public long getLid()
	{
		return lid;
	}
	public void setLid(long lid)
	{
		this.lid = lid;
	}
	public String getClient_ip()
	{
		return client_ip;
	}
	public void setClient_ip(String client_ip)
	{
		this.client_ip = client_ip;
	}
	public byte getType()
	{
		return type;
	}
	public void setType(byte type)
	{
		this.type = type;
	}
	public byte getSeverity()
	{
		return severity;
	}
	public void setSeverity(byte severity)
	{
		this.severity = severity;
	}
	public java.sql.Timestamp getLtime()
	{
		return ltime;
	}
	public void setLtime(java.sql.Timestamp ltime)
	{
		this.ltime = ltime;
	}
	public String getLtext()
	{
		return ltext;
	}
	public void setLtext(String ltext)
	{
		this.ltext = ltext;
	}
	
	@SuppressWarnings("unchecked")
	protected Map<String, Object> listInsertableFields()
	{
		try
		{
			Map<String, Object> props = BeanUtils.describe(this);
			if (getId() <= 0)
			{
				if(props.containsKey("id"))
				{
					props.remove("id");
				}
				if(props.containsKey("lid"))
				{
					props.remove("lid");
				}
			}
			props.remove("class");
			return props;
		}
		catch (Exception e)
		{
			throw new RuntimeException("Exception when Fetching fields of " + this);
		}
	}
}
